<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AlterOpenShopSiteLocationAddPlaceholderTimeColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('open_shop_site_locations', function (Blueprint $table) {
            $table->unsignedInteger('placeholderTime')->default(0)->comment('预占点位到期时间')->after('mainProcessId');
            $table->unsignedInteger('nearbyPlaceHolderId')->default(0)->comment('附近点位Id')->after('shopModelType');
            $table->decimal('nearbyPlaceHolderRange', 7, 2)->default(0)->comment('附近点位距离')->after('shopModelType');
            $table->string('mallId', 20)->default('')->comment('商场ID');
            $table->string('mallName', 64)->default('')->comment('商场名称');
            $table->unsignedTinyInteger('isWhiteList')->default(0)->comment('是否是白名单内的商场');
            $table->string('mallGrade', 4)->default('')->comment('商城等级');
            $table->unsignedTinyInteger('mallStatus')->default(0)->comment('商场开业状态');
            $table->unsignedTinyInteger('isAuditMall')->default(0)->comment('是否审核商场');
            $table->string('mallProvince', 32)->default('')->comment('商场省份');
            $table->string('mallCity', 32)->default('')->comment('商城城市');
            $table->string('mallDistrict', 32)->default('')->comment('商场区县');
            $table->string('mallArea', 64)->default('')->comment('商场区域');
            $table->string('mallAddress', 220)->default('')->comment('商场地址');
            $table->unsignedInteger('shopTotalNum')->default(0)->comment('商场铺位总数');
            $table->unsignedInteger('goShoppingNum')->default(0)->comment('商场购物铺位数');
            $table->unsignedInteger('gourmetShopNum')->default(0)->comment('美食铺位数');
            $table->decimal('gourmetShopRatio', 4, 2)->default(0)->comment('购物铺位占比');
            $table->decimal('star', 2, 1)->default(0)->comment('商场星级');
            $table->decimal('facilitiesRating', 2, 1)->default(0)->comment('设施评分');
            $table->decimal('environmentRating', 2, 1)->default(0)->comment('环境评分');
            $table->decimal('serviceRating', 2, 1)->default(0)->comment('服务评分');
            $table->string('businessDistrict', 64)->default('')->comment('商圈名称');
            $table->string('businessArea', 120)->default('')->comment('商圈区域');
            $table->string('businessAddress', 120)->default('')->comment('商圈详情地址');
            //$table->unsignedTinyInteger('cruiseOrderId')->default(0)->comment('商场信息关联表');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('open_shop_site_locations', function (Blueprint $table) {
            $table->dropColumn('placeholderTime');
            $table->dropColumn('nearbyPlaceHolderId');
            $table->dropColumn('nearbyPlaceHolderRange');
        });
    }
}
